﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hyt.Core;
using Autofac;
using Hyt.Core.Authentication;
using Hyt.Core.Interceptors;
using Hyt.Core.Security;
using Hyt.Passport.Persist;
using Hyt.Passport;
using Hyt.Passport.Service;
using Hyt.Test.Ioc;

namespace Hyt.Test
{
    public class TestUnitOfWork : UnitOfWork
    {
        public TestUnitOfWork() { }
        public TestUnitOfWork(bool usetrnas) : base(usetrnas) { }

        protected override void BuildContainer(ContainerBuilder builder)
        {
            base.BuildContainer(builder);
            new Merger().Register(builder,this);
            //builder.RegisterType<PassportPersistService>().As<IPersistService>().InstancePerLifetimeScope().OnActivated(t => this.AddPart(t.Instance)).PropertiesAutowired();
            //builder.RegisterType<AdministratorRepository>().As<IAdministratorRepository>().PropertiesAutowired();
            //builder.RegisterType<AdministratorService>().PropertiesAutowired();
            //builder.RegisterType<AuthInterceptor>().PropertiesAutowired();
            
            //AuthManager authManager=new AuthManager();
            //authManager.AddRule(new TestAuthRule());
            //builder.RegisterInstance(authManager).As<IAuthManager>();

            //Principal principal=new Principal();
            //principal.SetPrincipalId(new Guid());
            //principal.SetPrincipalType("member");
            this.SetPrincipal(Principal.Anonymous);
        }

        
    }
}
